package com.geo.result.controller;

import com.geo.result.component.TestReportTask;
import com.geo.result.domain.TestDemo;
import com.geo.result.domain.report.*;
import com.geo.result.service.IBasicReportService;
import com.sino.common.core.web.controller.BaseController;
import com.sino.common.core.web.page.TableDataInfo;
import org.mapstruct.Mapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/report")
public class BasicReportController extends BaseController {
    @Autowired
    IBasicReportService basicReportService;
    @Autowired
    TestReportTask taskReportTask;
    /**
     * 查询测试样例列表
     */
    @GetMapping("/receiveunit")
    public TableDataInfo getReceiveUnitReport(BasicReportCondition condition)
    {
        List<ReceiveUnitReport> list = basicReportService.selectReceiveUnitReportList(condition);
        return getDataTable(list);
    }


    @GetMapping("/industry")
    public TableDataInfo getIndustryReport(BasicReportCondition condition)
    {
        List<IndustryReport> list = basicReportService.selectIndustryReportList(condition);
        return getDataTable(list);
    }


    //典型应用分发情况统计报表
    @GetMapping("/typeapp")
    public TableDataInfo getTypeApplicationReport(BasicReportCondition condition)
    {
        List<TypeApplicationReport> list = basicReportService.selectTypeApplicationReportList(condition);
        return getDataTable(list);
    }


    //典型应用分发情况统计报表
    @GetMapping("/adminarea")
    public TableDataInfo getAdministrativeAreaReport(BasicReportCondition condition)
    {
        List<AdministrativeAreaReport> list = basicReportService.selectAdministrativeAreaReportList(condition);
        return getDataTable(list);
    }




    //重点项目分发情况统计报表
    @GetMapping("/mproject")
    public TableDataInfo getMajorProjectReport(BasicReportCondition condition)
    {
        List<MajorProjectReport> list = basicReportService.selectMajorProjectReportList(condition);
        return getDataTable(list);
    }

    //热点项目分发情况统计报表
    @GetMapping("/hproject")
    public TableDataInfo getHotProjectReport(BasicReportCondition condition)
    {
        List<HotProjectReport> list = basicReportService.selectHotProjectReportList(condition);
        return getDataTable(list);
    }


    //部门分发情况月报统计报表
    @GetMapping("/deptmonth")
    public TableDataInfo getDeptMonthReport(BasicReportCondition condition)
    {
        List<DeptMonthReport> list = basicReportService.selectDeptMonthReportList(condition);
        return getDataTable(list);
    }

    @GetMapping("/d4")
    public TableDataInfo getD4Report(BasicReportCondition condition)
    {
        List<D4Report> list = basicReportService.selectD4ReportList(condition);
        return getDataTable(list);
    }

    @GetMapping("/dxt")
    public TableDataInfo getDXTReport(BasicReportCondition condition)
    {
        List<DXTReport> list = basicReportService.selectDXTReportList(condition);
        return getDataTable(list);
    }

    @GetMapping("/point")
    public TableDataInfo getPointReport(BasicReportCondition condition)
    {
        List<PointReport> list = basicReportService.selectPointReportList(condition);
        return getDataTable(list);
    }

    @GetMapping("/dlgq")
    public TableDataInfo getDLGQReport(BasicReportCondition condition)
    {
        List<DLGQReport> list = basicReportService.selectDLGQReportList(condition);
        return getDataTable(list);
    }

    @GetMapping("/hscg")
    public TableDataInfo getHSCGReport(BasicReportCondition condition)
    {
        List<HSCGReport> list = basicReportService.selectHSCGReportList(condition);
        return getDataTable(list);
    }

    @GetMapping("/wxyx")
    public TableDataInfo getWXYXReport(BasicReportCondition condition)
    {
        List<WXYXReport> list = basicReportService.selectWXYXReportList(condition);
        return getDataTable(list);
    }

    @GetMapping("/testreport")
    public TableDataInfo getTestReport(BasicReportCondition condition)
    {
        try{
            taskReportTask.executeAsyncTask();
        }catch(InterruptedException e){
            System.out.println("执行异步任务出现错误");
        }
        System.out.println("调用Controller端完成");
        return null;
    }
}
